<section class="content-header">
	<h1>订单新增</h1>
	<ol class="breadcrumb">
		<li><a href="${basePath}"><i class="fa fa-dashboard"></i> 首页</a></li>
		<li><a href="#">服务管理</a></li>
		<li class="active">订单新增</li>
	</ol>
</section>
<section class="content" style="padding: 5px;">

	<div class="box box-default">

		<form id="order-form" name="order-form" class="form-horizontal"
			method="post">
			<input type="hidden" name="ord.id"/>
			<input type="hidden" name="binfo.id"/>
			<input type="hidden" name="idcard.id"/>
			<input type="hidden" name="employInfo.id"/>
			<input type="hidden" name="visInfo.id"/>
			<div class="box-body">
				<div class="col-md-12">

					<div class="nav-tabs-custom">
						<ul class="nav nav-tabs">
							<li class="active"><a href="#tab_1" data-toggle="tab">用户基本信息</a></li>
							<li><a href="#tab_2" data-toggle="tab">家庭关系信息</a></li>
							<li><a href="#tab_3" data-toggle="tab">公司信息</a></li>
							<li><a href="#tab_4" data-toggle="tab">签证信息</a></li>

						</ul>
						<div class="tab-content">
							<div class="tab-pane active" id="tab_1">
								<div class="row">
									<div class="col-md-6">
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">姓氏</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="binfo.familyName" placeholder="姓氏" required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">名字</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="binfo.givenName" placeholder="名字" required>
											</div>
										</div>
										<div class="form-group">
											<label for="minutes" class="col-sm-3 control-label">性别</label>

											<div class="col-sm-8">
												<label class="control-label"> <input type="radio"
													name="binfo.sex" data-flag="icheck" class="flat-red"
													value="M" checked="checked"> 男
												</label> &nbsp; <label class="control-label"> <input
													type="radio" name="binfo.sex" data-flag="icheck"
													class="flat-red" value="F"> 女
												</label>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">出生日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text" required
													class="form-control" data-flag="datepicker"
													data-format="yyyy-MM-dd" name="binfo.birth"
													placeholder="出生日期">
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">护照号码</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="binfo.passport" placeholder="护照号码" required
													pattern="[A-Z][0-9]{8}">
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">护照发行地</label>
											<div class="col-sm-8">
												<select name="binfo.placeIssure" type="text" required
													class="form-control select2" placeholder="护照发行地">
													<option value="AH">ANHUI</option>
													<option value="BJ">BEIJING</option>
													<option value="CH">CHONGQING</option>
													<option value="FJ">FUJIAN</option>
													<option value="GS">GANSU</option>
													<option value="GD">GUANGDONG</option>
													<option value="GX">GUANGXI</option>
													<option value="GU">GUIZHOU</option>
													<option value="HI">HAINAN</option>
													<option value="HE">HEBEI</option>
													<option value="HL">HEILONGJIANG</option>
													<option value="HN">HENAN</option>
													<option value="HK">HONG KONG (SPECIAL
														ADMINISTRATIVE REGION)</option>
													<option value="HB">HUBEI</option>
													<option value="HA">HUNAN</option>
													<option value="JS">JIANGSU</option>
													<option value="JX">JIANGXI</option>
													<option value="JL">JILIN</option>
													<option value="LN">LIAONING</option>
													<option value="MO">MACAO (SPECIAL ADMINISTRATIVE
														REGION)</option>
													<option value="NM">NEI MONGOL</option>
													<option value="NX">NINGXIA</option>
													<option value="QH">QINGHAI</option>
													<option value="SN">SHAANXI</option>
													<option value="SD">SHANDONG</option>
													<option value="SH">SHANGHAI</option>
													<option value="SX">SHANXI</option>
													<option value="SC">SICHUAN</option>
													<option value="TW">TAIWAN</option>
													<option value="TJ">TIANJIN</option>
													<option value="XJ">XINJIANG</option>
													<option value="XZ">XIZANG</option>
													<option value="YN">YUNNAN</option>
													<option value="ZJ">ZHEJIANG</option>

												</select>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">护照发行日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text" required
													class="form-control" data-flag="datepicker"
													data-format="yyyy-MM-dd" name="binfo.dateIssue"
													placeholder="护照发行日期">
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">护照失效日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text" required
													class="form-control" data-flag="datepicker"
													data-format="yyyy-MM-dd" name="binfo.dateExpiry"
													placeholder="护照失效日期">
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">个人关系</label>
											<div class="col-sm-8">
												<select name="binfo.relationship" type="text"
													class="form-control select2" placeholder="个人关系" required>
													<option value="F">De Facto</option>
													<option value="D">Divorced</option>
													<option value="E">Engaged</option>
													<option value="M">Married</option>
													<option value="N">Never Married</option>
													<option value="S">Separated</option>
													<option value="W">Widowed</option>
												</select>
											</div>
										</div>
									</div>
									<div class="col-md-6">
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">身份证姓氏</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="idcard.familyName" placeholder="身份证姓氏" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">身份证名字</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="idcard.givenName" placeholder="身份证名字" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">身份证号码</label>
											<div class="col-sm-8">
												<input type="text" class="form-control" name="idcard.idNum"
													placeholder="身份证号码" value="" required>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">身份证发行日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control" data-flag="datepicker"
													data-format="yyyy-MM-dd" name="idcard.dateIssue" required
													placeholder="身份证发行日期">
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">身份证失效日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control" data-flag="datepicker" required
													data-format="yyyy-MM-dd" name="idcard.dateExpiry"
													placeholder="身份证失效日期">
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">出生地省份</label>
											<div class="col-sm-8">
												<input type="text" class="form-control" required
													name="binfo.province" placeholder="出生地省份" value="">
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">出生地城市</label>
											<div class="col-sm-8">
												<input type="text" class="form-control" required
													name="binfo.city" placeholder="出生地城市" value="">
											</div>
										</div>

									</div>
								</div>
								<div class="row">
									<div class="col-md-6">
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">现居住地址1</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="binfo.currAddress1" placeholder="现居住地址1" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">现居住地址2</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="binfo.currAddress2" placeholder="现居住地址2" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">现居住省份</label>
											<div class="col-sm-8">
												<select name="binfo.currProvince" type="text"
													class="form-control select2" placeholder="个人关系" required>
													<option value="AH">ANHUI</option>
													<option value="BJ">BEIJING</option>
													<option value="CH">CHONGQING</option>
													<option value="FJ">FUJIAN</option>
													<option value="GS">GANSU</option>
													<option value="GD">GUANGDONG</option>
													<option value="GX">GUANGXI</option>
													<option value="GU">GUIZHOU</option>
													<option value="HI">HAINAN</option>
													<option value="HE">HEBEI</option>
													<option value="HL">HEILONGJIANG</option>
													<option value="HN">HENAN</option>
													<option value="HK">HONG KONG (SPECIAL
														ADMINISTRATIVE REGION)</option>
													<option value="HB">HUBEI</option>
													<option value="HA">HUNAN</option>
													<option value="JS">JIANGSU</option>
													<option value="JX">JIANGXI</option>
													<option value="JL">JILIN</option>
													<option value="LN">LIAONING</option>
													<option value="MO">MACAO (SPECIAL ADMINISTRATIVE
														REGION)</option>
													<option value="NM">NEI MONGOL</option>
													<option value="NX">NINGXIA</option>
													<option value="QH">QINGHAI</option>
													<option value="SN">SHAANXI</option>
													<option value="SD">SHANDONG</option>
													<option value="SH">SHANGHAI</option>
													<option value="SX">SHANXI</option>
													<option value="SC">SICHUAN</option>
													<option value="TW">TAIWAN</option>
													<option value="TJ">TIANJIN</option>
													<option value="XJ">XINJIANG</option>
													<option value="XZ">XIZANG</option>
													<option value="YN">YUNNAN</option>
													<option value="ZJ">ZHEJIANG</option>

												</select>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">现居住城市</label>

											<div class="col-sm-8 ">
												<input type="text" class="form-control"
													name="binfo.currTown" placeholder="现居住城市" value="" required>
											</div>
										</div>
										


									</div>
									<div class="col-md-6">
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">电话</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="binfo.businesPhone" placeholder="公司电话" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">移动电话</label>
											<div class="col-sm-8">
												<input type="text" class="form-control" name="binfo.mobile"
													placeholder="移动电话" value="" required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">邮箱地址</label>
											<div class="col-sm-8">
												<input type="text" class="form-control" name="binfo.email"
													placeholder="邮箱地址" value="" required>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">现居住地邮编</label>

											<div class="col-sm-8 ">
												<input type="text" class="form-control"
													name="binfo.postalCode" placeholder="现居住地邮编" value=""
													required>
											</div>
										</div>
									</div>

								</div>
							</div>
							<!-- /.tab-pane -->
							<div class="tab-pane" id="tab_2">
								<div class="dataTables_filter" id="searchDiv">
									<div class="btn-group">
										<button type="button" class="btn btn-default "
											data-btn-type="addFamily">新增</button>
										<button type="button" class="btn btn-default"
											data-btn-type="editFamily">编辑</button>
									</div>
									<div class="btn-group">
										<button type="button" class="btn btn-danger"
											data-btn-type="deleteFamily">删除</button>
									</div>
								</div>
								<table id="p_table" data-showFooter="false" data-search="false"
									data-page-size="10" data-page-number="1" data-pagination="true"
									data-click-to-select="true" data-toolbar="#searchDiv">
									<thead>
										<tr>
											<th data-checkbox="true"></th>
											<th data-field="id">id</th>
											<th data-field="relationship-value">家庭关系</th>
											<th data-field="familyName">姓氏</th>
											<th data-field="givenName">名称</th>
											<th data-field="sex">性别</th>
											<th data-field="birthdate">出生日期</th>
											<th data-field="togeth">是否同去</th>
										</tr>
									</thead>
								</table>

							</div>
							<!-- /.tab-pane -->
							<div class="tab-pane" id="tab_3">

								<div class="row">
									<div class="col-md-6">
										
<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">公司名称</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.organisation" placeholder="公司名称" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">职位</label>
											<div class="col-sm-8">
												<select name="employInfo.occupationGroup" type="text"
													required class="form-control select2" placeholder="职位"
													style="width: 300px;">
													<option value="1">Managers</option>
													<option value="2">Professionals</option>
													<option value="3">Technicians and Trades Workers</option>
													<option value="4">Community and Personal Service
														Workers</option>
													<option value="5">Clerical and Administrative
														Workers</option>
													<option value="6">Sales Workers</option>
													<option value="7">Machinery Operators and Drivers</option>
													<option value="8">Labourers</option>
													<option value="070299">Other</option>
												</select>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">其他职位</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.occupation" placeholder="其他职位" value="">
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">邮编</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.postalCode" placeholder="邮编" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">公司电话</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.phone" placeholder="公司电话" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">移动电话</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.mobile" placeholder="移动电话" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">邮箱地址</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.email" placeholder="邮箱地址" value=""
													required>
											</div>
										</div>



									</div>
									<div class="col-md-6">
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">入司日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text"
													class="form-control" data-flag="datepicker" required
													data-format="yyyy-MM-dd" name="employInfo.dateEmployer"
													placeholder="入司日期">
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">省份</label>
											<div class="col-sm-8">
												<select name="employInfo.province" type="text" required
													class="form-control select2" placeholder="省份">
													<option value="AH">ANHUI</option>
													<option value="BJ">BEIJING</option>
													<option value="CH">CHONGQING</option>
													<option value="FJ">FUJIAN</option>
													<option value="GS">GANSU</option>
													<option value="GD">GUANGDONG</option>
													<option value="GX">GUANGXI</option>
													<option value="GU">GUIZHOU</option>
													<option value="HI">HAINAN</option>
													<option value="HE">HEBEI</option>
													<option value="HL">HEILONGJIANG</option>
													<option value="HN">HENAN</option>
													<option value="HK">HONG KONG (SPECIAL
														ADMINISTRATIVE REGION)</option>
													<option value="HB">HUBEI</option>
													<option value="HA">HUNAN</option>
													<option value="JS">JIANGSU</option>
													<option value="JX">JIANGXI</option>
													<option value="JL">JILIN</option>
													<option value="LN">LIAONING</option>
													<option value="MO">MACAO (SPECIAL ADMINISTRATIVE
														REGION)</option>
													<option value="NM">NEI MONGOL</option>
													<option value="NX">NINGXIA</option>
													<option value="QH">QINGHAI</option>
													<option value="SN">SHAANXI</option>
													<option value="SD">SHANDONG</option>
													<option value="SH">SHANGHAI</option>
													<option value="SX">SHANXI</option>
													<option value="SC">SICHUAN</option>
													<option value="TW">TAIWAN</option>
													<option value="TJ">TIANJIN</option>
													<option value="XJ">XINJIANG</option>
													<option value="XZ">XIZANG</option>
													<option value="YN">YUNNAN</option>
													<option value="ZJ">ZHEJIANG</option>

												</select>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">城市</label>

											<div class="col-sm-8 ">
												<input type="text" class="form-control"
													name="employInfo.town" placeholder="城市" value="" required>
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">公司地址1</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.address1" placeholder="公司地址1" value=""
													required>
											</div>
										</div>
										<div class="form-group">
											<label for="servicesName" class="col-sm-3 control-label">公司地址2</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="employInfo.address2" placeholder="公司地址2" value=""
													required>
											</div>
										</div>

									</div>

								</div>

							</div>
							<!-- /.tab-pane -->

							<div class="tab-pane " id="tab_4">
								<div class="row">
									<div class="col-md-6">

										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">出行因由</label>
											<div class="col-sm-8">
												<select name="visInfo.vistitReason" type="text"
													class="form-control select2" placeholder="出行因由" required style="width:200px;">
													<option value="2">Business</option>
													<option value="3">Tourism</option>
													<option value="4">Family visit</option>
													<option value="5">Study</option>
													<option value="6">Religious event</option>
													<option value="7">other</option>
												</select>
											</div>
										</div>

										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">费用承担说明</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="visInfo.fundingStayInfo" placeholder="费用承担说明" required>
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">行程开始日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text" required
													class="form-control" data-flag="datepicker"
													data-format="yyyy-MM-dd" name="ord.strokeStartDate"
													placeholder="行程开始日期">
											</div>
										</div>
										<div class="form-group">
											<label for="spercent" class="col-sm-3 control-label">行程截止日期</label>

											<div class="col-sm-8 input-group">
												<span class="input-group-addon"><i
													class="fa fa-calendar"></i></span> <input type="text" required
													class="form-control" data-flag="datepicker"
													data-format="yyyy-MM-dd" name="ord.strokeEndDate"
													placeholder="行程截止日期">
											</div>
										</div>
									</div>
									<div class="col-md-6">
										<div class="form-group">
											<label for="minutes" class="col-sm-3 control-label">其他国家签证</label>

											<div class="col-sm-8">
												<label class="control-label"> <input type="radio"
													name="visInfo.hastoOtherCountry" data-flag="icheck"
													class="flat-red" value="1" checked="checked"> 是
												</label> &nbsp; <label class="control-label"> <input
													type="radio" name="visInfo.hastoOtherCountry"
													data-flag="icheck" class="flat-red" value="2"> 否
												</label>
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">其他国家签证说明</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="visInfo.hastoOtherCountryDetails"
													placeholder="其他国家签证说明">
											</div>
										</div>

										<div class="form-group">
											<label for="minutes" class="col-sm-3 control-label">是否被拒签</label>

											<div class="col-sm-8">
												<label class="control-label"> <input type="radio"
													name="visInfo.hasRefuse" data-flag="icheck"
													class="flat-red" value="1" checked="checked"> 是
												</label> &nbsp; <label class="control-label"> <input
													type="radio" name="visInfo.hasRefuse" data-flag="icheck"
													class="flat-red" value="2"> 否
												</label>
											</div>
										</div>
										<div class="form-group">
											<label for="appName" class="col-sm-3 control-label">拒签说明</label>
											<div class="col-sm-8">
												<input type="text" class="form-control"
													name="visInfo.hasRefuseDetails" placeholder="拒签说明">
											</div>
										</div>
									</div>
								</div>
							</div>
						
						<!-- /.tab-content -->
					</div>

							</div>

				</div>

			</div>
			<!-- /.box-body -->
			<div class="box-footer ">
				<!--以下两种方式提交验证,根据所需选择-->
				<button  data-save-type="tmpSave" class="btn btn-default" type="button">暂存</button>
				<button type="submit" class="btn btn-primary pull-right"
					data-btn-type="save">提交</button>
			</div>
			<!-- /.box-footer -->
		</form>

	</div>



</section>

<script th:inline="javascript">
	var winId = 'addFamilyMember';
	var editRows = null;
	var selected_index = null;
	var addRow_index = null;
	var ordForm=null;
	$(function() {
		
	    var edit_ord_id = /*[[${id}]]*/ null;
		if(edit_ord_id != null){
			loadordDetails(edit_ord_id);
		}
		//初始化控件
		ordForm = $("#order-form").form({
			baseEntity : false
		});
		$("#order-form").bootstrapValidator({
			message : '请输入有效值',
			excluded : [ function($field, validator) {
				return ($field.attr('data-c-valid') == 'false');
			} ],
			feedbackIcons : {
				valid : 'glyphicon glyphicon-ok',
				invalid : 'glyphicon glyphicon-remove',
				validating : 'glyphicon glyphicon-refresh'
			},
			fields : {
				'binfo.sex' : {
					validators : {
						notEmpty : {}
					}
				},
				togeth : {
					validators : {
						notEmpty : {}
					}
				},
				"visInfo.hastoOtherCountry" : {
					validators : {
						notEmpty : {}
					}
				},
				"visInfo.hasRefuse" : {
					validators : {
						notEmpty : {}
					}
				}
			},
			submitHandler : function(validator, userform, submitButton) {

				modals.confirm('确认保存？', function() {
					saveOrCommit('1',function(data){
						loadOrdAddPage(data);
						alalert.succ('提交成功');
					});
				});
			}
		});
		ordForm.initComponent();
		//loadDebug();

		addRow_index = 100;

		$('#p_table').bootstrapTable({
			onCheck : function(row, $element) {
				selected_index = $element.data('index');
			}
		});
		$('button[data-save-type=tmpSave]').click(function() {
			saveOrCommit('0',function(data){
				loadOrdAddPage(data);
				alalert.succ('暂存成功');
			});
		});
		$('button[data-btn-type]').click(function() {
			var action = $(this).attr('data-btn-type');
			var rows = $('#p_table').bootstrapTable('getSelections');
			switch (action) {
			case 'addFamily':
				modals.openWin({
					winId : winId,
					title : '新增家庭成员',
					width : '900px',
					url : context + "/order/toeditFamily"

				});
				break;
			case 'editFamily':
				if (rows.length != 1) {
					modals.info('请选择1行进行编辑');
					return false;
				}
				editRows = rows[0];
				modals.openWin({
					winId : winId,
					title : '编辑家庭成员',
					width : '900px',
					url : context + "/order/toeditFamily",
					hideFunc : function() {
						editRows = null;
					}
				});
				break;
			case 'deleteFamily':
				if (rows.length != 1) {
					modals.info('请选择1行进行删除');
					return false;
				}
				editRows = rows[0];
				$('#p_table').bootstrapTable('remove', {
					field : 'id',
					values : new Array(editRows.id)
				});
				editRows = null;

			}
		});
		
		
		function saveOrCommit(issave,callback){
			var params = ordForm.getFormSimpleData();
			var familyMembers =$('#p_table').bootstrapTable('getData')||[];
			for(var i in familyMembers){
				var fm = familyMembers[i];
				if(fm.id && (""+fm.id).indexOf("t")==0){
					fm.id=null;
				}
			}
			params.familyMembers=familyMembers;
			params.saveStatus = issave;
			console.log(params);
			doRequest({
				url : context + '/order/doEditOrder',
				type : 'POST',
				data : JSON.stringify(params),
				isbody : true
			}, function(data) {
				
				console.log(data);
				callback(data);
			});
		}
		
		function loadordDetails(id){
			doRequest({
				url : context + '/order/loaddetails?id='+id
			}, function(data) {
				console.log(data);
				loadOrdAddPage(data);
			});
		}

	});

	function addFamilyMember(fm) {

		var rowData = {};
		transferFm(fm);
		rowData.row = fm;
		if (editRows != null) {
			rowData.index = selected_index;
			$('#p_table').bootstrapTable('updateRow', rowData);
		} else {
			rowData.index = addRow_index++;
			rowData.row.id = 't' + rowData.index
			console.log(rowData);
			$('#p_table').bootstrapTable('insertRow', rowData);
		}

	}

	function transferFm(fm) {
		fm["relationship-value"] = reship(fm.relationShip);
	}

	
	
	function loadDebug() {
		doRequest({
			url : context + '/order/loadDebugInfo'
		}, function(data) {
			console.log(data);
			loadOrdAddPage(data);
		});
	}
	
	function loadOrdAddPage(data){
		ordForm.initFormData(data);
		var fmOrigns = data.familyMembers;
		for ( var i in fmOrigns) {
			transferFm(fmOrigns[i]);
		}
		$('#p_table').bootstrapTable('load', fmOrigns);
	}
</script>
